<?php
class ControllerHkWechatInland extends Controller {
private $error = array();

	public function index() {
		$this->language->load('hk/wechat_inland');

		$this->document->setTitle($this->language->get('heading_title'));
		$this->load->model('hk/wechat_inland');
		// var_dump(111);exit;

		$this->getList();
	}

	public function add() {
		$this->language->load('hk/wechat_inland');

		$this->document->setTitle($this->language->get('heading_title'));

		$this->load->model('hk/wechat_inland');
		// var_dump($this->request->post);exit;
		if (($this->request->server['REQUEST_METHOD'] == 'POST') && $this->validateForm()) {
<<<<<<< HEAD
<<<<<<< HEAD
			// var_dump($this->request->post,$this->model_hk_wechat_inland->getWechatFiles($this->request->post['no_1_child']));exit;
			$this->model_hk_wechat_inland->addWechatInland($this->request->post);
=======
			// var_dump($this->request->post,$this->model_hk_wechat_inland->getProjectFiles($this->request->post['no_1_child']));exit;
			$this->model_hk_wechat_inland->addVendorChecklist($this->request->post);
>>>>>>> d186f0ac043b98de93b00ad49075690d01e0cbaa
=======
			// var_dump($this->request->post,$this->model_hk_wechat_inland->getProjectFiles($this->request->post['no_1_child']));exit;
			$this->model_hk_wechat_inland->addVendorChecklist($this->request->post);
>>>>>>> d186f0ac043b98de93b00ad49075690d01e0cbaa

			$this->session->data['success'] = $this->language->get('text_success');

			$url = '';

			if (isset($this->request->get['sort'])) {
				$url .= '&sort=' . $this->request->get['sort'];
			}

			if (isset($this->request->get['order'])) {
				$url .= '&order=' . $this->request->get['order'];
			}

			if (isset($this->request->get['page'])) {
				$url .= '&page=' . $this->request->get['page'];
			}

			$this->response->redirect($this->url->link('hk/wechat_inland', 'token=' . $this->session->data['token'] . $url, 'SSL'));
		}

		$this->getForm();
	}

	public function edit() {
		$this->language->load('hk/wechat_inland');

		$this->document->setTitle($this->language->get('heading_title'));

		$this->load->model('hk/wechat_inland');

		if (($this->request->server['REQUEST_METHOD'] == 'POST') && $this->validateForm()) {
			// var_dump($this->request->post);exit;
<<<<<<< HEAD
<<<<<<< HEAD
			$this->model_hk_wechat_inland->editWechatInland($this->request->get['wechat_id'], $this->request->post);
=======
			$this->model_hk_wechat_inland->editVendorChecklist($this->request->get['project_progress_id'], $this->request->post);
>>>>>>> d186f0ac043b98de93b00ad49075690d01e0cbaa
=======
			$this->model_hk_wechat_inland->editVendorChecklist($this->request->get['project_progress_id'], $this->request->post);
>>>>>>> d186f0ac043b98de93b00ad49075690d01e0cbaa

			$this->session->data['success'] = $this->language->get('text_success');

			$url = '';

			if (isset($this->request->get['sort'])) {
				$url .= '&sort=' . $this->request->get['sort'];
			}

			if (isset($this->request->get['order'])) {
				$url .= '&order=' . $this->request->get['order'];
			}

			if (isset($this->request->get['page'])) {
				$url .= '&page=' . $this->request->get['page'];
			}

			$this->response->redirect($this->url->link('hk/wechat_inland', 'token=' . $this->session->data['token'] . $url, 'SSL'));
		}

		$this->getForm();
	}

<<<<<<< HEAD
<<<<<<< HEAD
=======
=======
>>>>>>> d186f0ac043b98de93b00ad49075690d01e0cbaa
	public function delete() {
		$this->language->load('hk/wechat_inland');

		$this->document->setTitle($this->language->get('heading_title'));

		$this->load->model('hk/wechat_inland');

		if (isset($this->request->post['selected']) && $this->validateDelete()) {
			foreach ($this->request->post['selected'] as $project_progress_id) {
				$this->model_hk_wechat_inland->deleteVendorChecklist($project_progress_id);
			}

			$this->session->data['success'] = $this->language->get('text_success');

			$url = '';

			if (isset($this->request->get['sort'])) {
				$url .= '&sort=' . $this->request->get['sort'];
			}

			if (isset($this->request->get['order'])) {
				$url .= '&order=' . $this->request->get['order'];
			}

			if (isset($this->request->get['page'])) {
				$url .= '&page=' . $this->request->get['page'];
			}

			$this->response->redirect($this->url->link('hk/wechat_inland', 'token=' . $this->session->data['token'] . $url, 'SSL'));
		}

		$this->getList();
	}

<<<<<<< HEAD
>>>>>>> d186f0ac043b98de93b00ad49075690d01e0cbaa
=======
>>>>>>> d186f0ac043b98de93b00ad49075690d01e0cbaa
	public function repair() {
		$this->language->load('hk/wechat_inland');

		$this->document->setTitle($this->language->get('heading_title'));

		$this->load->model('hk/wechat_inland');

		if ($this->validateRepair()) {
			$this->model_hk_wechat_inland->repairCategories();

			$this->session->data['success'] = $this->language->get('text_success');

			$this->response->redirect($this->url->link('hk/wechat_inland', 'token=' . $this->session->data['token'], 'SSL'));
		}

		$this->getList();
	}

	protected function getList() {
<<<<<<< HEAD
<<<<<<< HEAD
		if (isset($this->request->get['filter_customer_name'])) {
			$filter_customer_name = $this->request->get['filter_customer_name'];
		} else {
			$filter_customer_name = null;
		}

		if (isset($this->request->get['filter_admin_name'])) {
			$filter_admin_name = $this->request->get['filter_admin_name'];
		} else {
			$filter_admin_name = null;
		}

		if (isset($this->request->get['filter_admin_tel'])) {
			$filter_admin_tel = $this->request->get['filter_admin_tel'];
		} else {
			$filter_admin_tel = null;
=======
=======
>>>>>>> d186f0ac043b98de93b00ad49075690d01e0cbaa
		// var_dump($this->request->request);exit;
		if (isset($this->request->get['filter_ckg_number'])) {
			$filter_ckg_number = $this->request->get['filter_ckg_number'];
		} else {
			$filter_ckg_number = null;
		}

		if (isset($this->request->get['filter_project_name'])) {
			$filter_project_name = $this->request->get['filter_project_name'];
		} else {
			$filter_project_name = null;
		}

		if (isset($this->request->get['filter_english_name_of_supplier'])) {
			$filter_english_name_of_supplier = $this->request->get['filter_english_name_of_supplier'];
		} else {
			$filter_english_name_of_supplier = null;
<<<<<<< HEAD
>>>>>>> d186f0ac043b98de93b00ad49075690d01e0cbaa
=======
>>>>>>> d186f0ac043b98de93b00ad49075690d01e0cbaa
		}

		if (isset($this->request->get['filter_status'])) {
			$filter_status = $this->request->get['filter_status'];
		} else {
			$filter_status = null;
		}

<<<<<<< HEAD
<<<<<<< HEAD
		if (isset($this->request->get['filter_bank'])) {
			$filter_bank = $this->request->get['filter_bank'];
		} else {
			$filter_bank = null;
		}
		// if (isset($this->request->get['filter_customer_name']) && isset($this->request->get['filter_customer_value']) ) {
		// 	$filter_customer_name = $this->request->get['filter_customer_name'];
		// 	$filter_customer_value = $this->request->get['filter_customer_value'];
		// 	// var_dump(111);exit;
		// } else {
		// 	$filter_customer_name = null;
		// 	$filter_customer_value = null;
		// }
=======
=======
>>>>>>> d186f0ac043b98de93b00ad49075690d01e0cbaa
		if (isset($this->request->get['filter_customer_name']) && isset($this->request->get['filter_customer_value']) ) {
			$filter_customer_name = $this->request->get['filter_customer_name'];
			$filter_customer_value = $this->request->get['filter_customer_value'];
			// var_dump(111);exit;
		} else {
			$filter_customer_name = null;
			$filter_customer_value = null;
		}
<<<<<<< HEAD
>>>>>>> d186f0ac043b98de93b00ad49075690d01e0cbaa
=======
>>>>>>> d186f0ac043b98de93b00ad49075690d01e0cbaa


		if (isset($this->request->get['sort'])) {
			$sort = $this->request->get['sort'];
		} else {
			$sort = 'name';
		}

		if (isset($this->request->get['order'])) {
			$order = $this->request->get['order'];
		} else {
			$order = 'DESC';
		}

		if (isset($this->request->get['page'])) {
			$page = $this->request->get['page'];
		} else {
			$page = 1;
		}

		$url = '';
<<<<<<< HEAD
<<<<<<< HEAD
		if (isset($this->request->get['filter_customer_name'])) {
			$url .= '&filter_customer_name=' . urlencode(html_entity_decode($this->request->get['filter_customer_name'], ENT_QUOTES, 'UTF-8'));
		}

		if (isset($this->request->get['filter_admin_name'])) {
			$url .= '&filter_admin_name=' . urlencode(html_entity_decode($this->request->get['filter_admin_name'], ENT_QUOTES, 'UTF-8'));
		}

		if (isset($this->request->get['filter_admin_tel'])) {
			$url .= '&filter_admin_tel=' . urlencode(html_entity_decode($this->request->get['filter_admin_tel'], ENT_QUOTES, 'UTF-8'));
		}

		if (isset($this->request->get['filter_bank'])) {
			$url .= '&filter_bank=' . urlencode(html_entity_decode($this->request->get['filter_bank'], ENT_QUOTES, 'UTF-8'));
		}
		// if (isset($this->request->get['filter_customer_name']) && isset($this->request->get['filter_customer_value']) ) {
		// 	$url .= '&filter_customer_name=' . urlencode(html_entity_decode($this->request->get['filter_customer_name'], ENT_QUOTES, 'UTF-8'));
		// 	$url .= '&filter_customer_value=' . urlencode(html_entity_decode($this->request->get['filter_customer_value'], ENT_QUOTES, 'UTF-8'));
		// }
=======
=======
>>>>>>> d186f0ac043b98de93b00ad49075690d01e0cbaa
		if (isset($this->request->get['filter_ckg_number'])) {
			$url .= '&filter_ckg_number=' . urlencode(html_entity_decode($this->request->get['filter_ckg_number'], ENT_QUOTES, 'UTF-8'));
		}

		if (isset($this->request->get['filter_project_name'])) {
			$url .= '&filter_project_name=' . urlencode(html_entity_decode($this->request->get['filter_project_name'], ENT_QUOTES, 'UTF-8'));
		}

		if (isset($this->request->get['filter_english_name_of_supplier'])) {
			$url .= '&filter_english_name_of_supplier=' . urlencode(html_entity_decode($this->request->get['filter_english_name_of_supplier'], ENT_QUOTES, 'UTF-8'));
		}

		if (isset($this->request->get['filter_customer_name']) && isset($this->request->get['filter_customer_value']) ) {
			$url .= '&filter_customer_name=' . urlencode(html_entity_decode($this->request->get['filter_customer_name'], ENT_QUOTES, 'UTF-8'));
			$url .= '&filter_customer_value=' . urlencode(html_entity_decode($this->request->get['filter_customer_value'], ENT_QUOTES, 'UTF-8'));
		}
<<<<<<< HEAD
>>>>>>> d186f0ac043b98de93b00ad49075690d01e0cbaa
=======
>>>>>>> d186f0ac043b98de93b00ad49075690d01e0cbaa

		if (isset($this->request->get['filter_status'])) {
			$url .= '&filter_status=' . $this->request->get['filter_status'];
		}

		if (isset($this->request->get['sort'])) {
			$url .= '&sort=' . $this->request->get['sort'];
		}

		if (isset($this->request->get['order'])) {
			$url .= '&order=' . $this->request->get['order'];
		}

		if (isset($this->request->get['page'])) {
			$url .= '&page=' . $this->request->get['page'];
		}

		$data['breadcrumbs'] = array();

		$data['breadcrumbs'][] = array(
			'text' => $this->language->get('text_home'),
			'href' => $this->url->link('common/dashboard', 'token=' . $this->session->data['token'], 'SSL')
		);

		$data['breadcrumbs'][] = array(
			'text' => $this->language->get('heading_title'),
			'href' => $this->url->link('hk/wechat_inland', 'token=' . $this->session->data['token'] . $url, 'SSL')
		);

		$data['add'] = $this->url->link('hk/wechat_inland/add', 'token=' . $this->session->data['token'] . $url, 'SSL');
		$data['delete'] = $this->url->link('hk/wechat_inland/delete', 'token=' . $this->session->data['token'] . $url, 'SSL');
		$data['repair'] = $this->url->link('hk/wechat_inland/repair', 'token=' . $this->session->data['token'] . $url, 'SSL');

<<<<<<< HEAD
<<<<<<< HEAD
		$data['wechats'] = array();

		$filter_data = array(
			'filter_customer_name' => $filter_customer_name,
			'filter_admin_tel'     => $filter_admin_tel,
			'filter_admin_name'    => $filter_admin_name,
			'filter_bank'          => $filter_bank,
			'filter_status'        => $filter_status,
			'sort'                 => $sort,
			'order'                => $order,
			'start'                => ($page - 1) * $this->config->get('config_limit_admin'),
			'limit'                => $this->config->get('config_limit_admin')
		);
		$category_total = $this->model_hk_wechat_inland->getTotalCategories($filter_data);

		$results = $this->model_hk_wechat_inland->getWechatList($filter_data);

		foreach ($results as $result) {

			$data['wechats'][] = array(
				'wechat_id'                 => $result['wechat_id'],
				'no_1'                      => (!empty($result['no_1']))?'Y':'N',
				'no_1_name'                 => (!empty($result['data']['no_1']))?($result['data']['no_1']['file_name']):'',
				'no_1_url'                  => (!empty($result['data']['no_1']))?substr($result['data']['no_1']['file_url'],54):'', 
				'no_2'                      => (!empty($result['no_2']))?'Y':'N',
				'no_2_name'                 => (!empty($result['data']['no_2']))?($result['data']['no_2']['file_name']):'',
				'no_2_url'                  => (!empty($result['data']['no_2']))?substr($result['data']['no_2']['file_url'],54):'',
				'no_3'                      => (!empty($result['no_3']))?'Y':'N',
				'no_3_name'                 => (!empty($result['data']['no_3']))?($result['data']['no_3']['file_name']):'',
				'no_3_url'                  => (!empty($result['data']['no_3']))?substr($result['data']['no_3']['file_url'],54):'',
				'no_4'                      => (!empty($result['no_4']))?'Y':'N',
				'no_4_name'                 => (!empty($result['data']['no_4']))?($result['data']['no_4']['file_name']):'',
				'no_4_url'                  => (!empty($result['data']['no_4']))?substr($result['data']['no_4']['file_url'],54):'',
				'customer_name'             => $result['customer_name'],
				'admin_name'                => $result['admin_name'],
				'admin_email'               => $result['admin_email'],
				'admin_tel'                 => $result['admin_tel'],
				'company_tel'               => $result['company_tel'],
				'company_bank_account_name' => $result['company_bank_account_name'],
				'company_bank_account_num'  => $result['company_bank_account_num'],
				'bank'                      => $result['bank'],
				'wechat_login_name'         => $result['wechat_login_name'],
				'status'         			=> $this->language->get('wechat_status_'.$result['status']),
				'wechat_login_password'     => (isset($result['wechat_login_password']))?$result['wechat_login_password']:'',
				
				'edit'                      => $this->url->link('hk/wechat_inland/edit', 'token=' . $this->session->data['token'] . '&wechat_id=' . $result['wechat_id'] . $url, 'SSL'),
				'delete'                    => $this->url->link('hk/wechat_inland/delete', 'token=' . $this->session->data['token'] . '&wechat_id=' . $result['wechat_id'] . $url, 'SSL'),
=======
=======
>>>>>>> d186f0ac043b98de93b00ad49075690d01e0cbaa
		$data['projects'] = array();

		$filter_data = array(
			'filter_ckg_number'	  => $filter_ckg_number,
			'filter_project_name'	  => $filter_project_name,
			'filter_english_name_of_supplier' => $filter_english_name_of_supplier,
			'filter_customer_value'   => $filter_customer_value,
			'filter_customer_name'   => $filter_customer_name,
			'filter_status'   => $filter_status,
			'sort'  => $sort,
			'order' => $order,
			'start' => ($page - 1) * $this->config->get('config_limit_admin'),
			'limit' => $this->config->get('config_limit_admin')
		);
		$category_total = $this->model_hk_wechat_inland->getTotalCategories($filter_data);
		// var_dump($filter_data);exit;
		$results = $this->model_hk_wechat_inland->getProjectProgresslist($filter_data);
		// var_dump($results);exit;
		// var_dump(111);exit;
		foreach ($results as $result) {
			// var_dump((!empty($result['data']['no_1']))?substr($result['data']['no_1']['file_url'],54):'');exit;
			$vendor_details_id_1 = (!empty($result['vendor_details_id_1']))?$this->url->link('vendor/vendor_details/edit', 'token=' . $this->session->data['token'] . '&vendor_details_id=' . $result['vendor_details_id_1'] , 'SSL'):'';

			$vendor_details_id_2 = (!empty($result['vendor_details_id_2']))?$this->url->link('vendor/vendor_details/edit', 'token=' . $this->session->data['token'] . '&vendor_details_id=' . $result['vendor_details_id_2'] , 'SSL'):'';

			$vendor_details_id_3 = (!empty($result['vendor_details_id_3']))?$this->url->link('vendor/vendor_details/edit', 'token=' . $this->session->data['token'] . '&vendor_details_id=' . $result['vendor_details_id_3'] , 'SSL'):'';

			$data['projects'][] = array(
				'project_progress_id' => $result['project_progress_id'],
				'ckg_number' => $result['ckg_number'],
				'project_name' => $result['project_name'],
				'project_customer' => $result['data']['project_customer'],
				'vendor_1' => $result['data']['vendor_1'],
				'vendor_2' => $result['data']['vendor_2'],
				'vendor_3' => $result['data']['vendor_3'],

				'no_1' => (!empty($result['no_1']))?'Y':'N',
				'no_1_name' => (!empty($result['data']['no_1']))?($result['data']['no_1']['file_name']):'',
				'no_1_url' => (!empty($result['data']['no_1']))?substr($result['data']['no_1']['file_url'],54):'',
				'no_2' => (!empty($result['no_2']))?date("Y-m-d",(int)$result['no_2']):'',
				'no_3' => $result['no_3'],
				'no_4' => $result['no_4'],
				'no_5' => (!empty($result['no_5']))?'Y':'N',
				'no_5_name' => (!empty($result['data']['no_5']))?($result['data']['no_5']['file_name']):'',
				'no_5_url' => (!empty($result['data']['no_5']))?substr($result['data']['no_5']['file_url'],54):'', 
				'no_6' => (!empty($result['no_6']))?'Y':'N',
				'no_6_name' => (!empty($result['data']['no_6']))?($result['data']['no_6']['file_name']):'',
				'no_6_url' => (!empty($result['data']['no_6']))?substr($result['data']['no_6']['file_url'],54):'',
				'no_7' => (!empty($result['no_7']))?'Y':'N',
				'no_7_name' => (!empty($result['data']['no_7']))?($result['data']['no_7']['file_name']):'',
				'no_7_url' => (!empty($result['data']['no_7']))?substr($result['data']['no_7']['file_url'],54):'',
				'no_8' => (!empty($result['no_8']))?'Y':'N',
				'no_8_name' => (!empty($result['data']['no_8']))?($result['data']['no_8']['file_name']):'',
				'no_8_url' => (!empty($result['data']['no_8']))?substr($result['data']['no_8']['file_url'],54):'',
				'no_9' => (!empty($result['no_9']))?'Y':'N',
				'no_9_name' => (!empty($result['data']['no_9']))?($result['data']['no_9']['file_name']):'',
				'no_9_url' => (!empty($result['data']['no_9']))?substr($result['data']['no_9']['file_url'],54):'',
				'no_10' => (!empty($result['no_10']))?'Y':'N',
				'no_10_name' => (!empty($result['data']['no_10']))?($result['data']['no_10']['file_name']):'',
				'no_10_url' => (!empty($result['data']['no_10']))?substr($result['data']['no_10']['file_url'],54):'',
				'no_11' => (!empty($result['no_11']))?'Y':'N',
				'no_11_name' => (!empty($result['data']['no_11']))?($result['data']['no_11']['file_name']):'',
				'no_11_url' => (!empty($result['data']['no_11']))?substr($result['data']['no_11']['file_url'],54):'',
				'no_12' => (!empty($result['no_12']) && count(explode(",", $result['no_12'])) >= 3 )?'Y':'N',
				'no_12_name' => (!empty($result['data']['no_12']))?($result['data']['no_12']['file_name']):'',
				'no_12_url' => (!empty($result['data']['no_12']))?substr($result['data']['no_12']['file_url'],54):'',
				'no_13' => (!empty($result['no_13']) && count(explode(",", $result['no_13'])) >= 3 )?'Y':'N',
				'no_13_name' => (!empty($result['data']['no_13']))?($result['data']['no_13']['file_name']):'',
				'no_13_url' => (!empty($result['data']['no_13']))?substr($result['data']['no_13']['file_url'],54):'',
				'no_14' => (!empty($result['data']['no_14']))?'Y':'N',
				'no_14_name' => (!empty($result['data']['no_14']))?($result['data']['no_14']['file_name']):'',
				'no_14_url' => (!empty($result['data']['no_14']))?substr($result['data']['no_14']['file_url'],54):'',
				'no_16' => (!empty($result['no_16']))?'Y':'N',
				'no_16_name' => (!empty($result['data']['no_16']))?($result['data']['no_16']['file_name']):'',
				'no_16_url' => (!empty($result['data']['no_16']))?substr($result['data']['no_16']['file_url'],54):'',
				'no_17' => (!empty($result['no_17']))?'Y':'N',
				'no_17_name' => (!empty($result['data']['no_17']))?($result['data']['no_17']['file_name']):'',
				'no_17_url' => (!empty($result['data']['no_17']))?substr($result['data']['no_17']['file_url'],54):'',
				'confirm' => (!empty($result['confirm']))?'Y':'N',
				'follow_up_history' => $result['follow_up_history'],
				'remark' => $result['remark'],
				'status' => $result['data']['status'],
				'ckg_number_msg' => (isset($result['ckg_number_msg']))?$result['ckg_number_msg']:'',

				'edit'        => $this->url->link('hk/wechat_inland/edit', 'token=' . $this->session->data['token'] . '&project_progress_id=' . $result['project_progress_id'] . $url, 'SSL'),
				'delete'      => $this->url->link('hk/wechat_inland/delete', 'token=' . $this->session->data['token'] . '&project_progress_id=' . $result['project_progress_id'] . $url, 'SSL'),
				'vendor_edit_1' => $vendor_details_id_1,
				'vendor_edit_2' => $vendor_details_id_2,
				'vendor_edit_3' => $vendor_details_id_3,
<<<<<<< HEAD
>>>>>>> d186f0ac043b98de93b00ad49075690d01e0cbaa
=======
>>>>>>> d186f0ac043b98de93b00ad49075690d01e0cbaa
			);

		}
		// var_dump($data['projects']);exit;
<<<<<<< HEAD
<<<<<<< HEAD
		$data['heading_title']                  = $this->language->get('heading_title');
		
		$data['text_list']                      = $this->language->get('text_list');
		$data['text_num']                      = $this->language->get('text_num');
		$data['text_no_results']                = $this->language->get('text_no_results');
		$data['text_confirm']                   = $this->language->get('text_confirm');
		
		$data['button_filter']                  = $this->language->get('button_filter');
		
		$data['column_customer_search']         = $this->language->get('column_customer_search');
		
		$data['column_project_customer_search'] = $this->language->get('column_project_customer_search');
		$data['column_name']                    = $this->language->get('column_name');
		$data['column_sort_order']              = $this->language->get('column_sort_order');
		$data['column_action']                  = $this->language->get('column_action');
		//wechat_inland column
		$data['column_status']                      = $this->language->get('column_status');
		$data['column_no_1']                      = $this->language->get('column_no_1');
		$data['column_no_2']                      = $this->language->get('column_no_2');
		$data['column_no_3']                      = $this->language->get('column_no_3');
		$data['column_no_4']                      = $this->language->get('column_no_4');
		$data['column_customer_name']             = $this->language->get('column_customer_name');
		$data['column_admin_name']                = $this->language->get('column_admin_name');
		$data['column_admin_email']               = $this->language->get('column_admin_email');
		$data['column_admin_tel']                 = $this->language->get('column_admin_tel');
		$data['column_company_tel']               = $this->language->get('column_company_tel');
		$data['column_company_bank_account_name'] = $this->language->get('column_company_bank_account_name');
		$data['column_company_bank_account_num']  = $this->language->get('column_company_bank_account_num');
		$data['column_bank']                      = $this->language->get('column_bank');
		$data['column_wechat_login_name']         = $this->language->get('column_wechat_login_name');
		$data['column_wechat_login_password']     = $this->language->get('column_wechat_login_password');
=======
=======
>>>>>>> d186f0ac043b98de93b00ad49075690d01e0cbaa
		$data['heading_title'] = $this->language->get('heading_title');

		$data['text_list'] = $this->language->get('text_list');
		$data['text_no_results'] = $this->language->get('text_no_results');
		$data['text_confirm'] = $this->language->get('text_confirm');

		$data['text_status_1'] = $this->language->get('text_status_1');
		$data['text_status_2'] = $this->language->get('text_status_2');
		$data['text_status_3'] = $this->language->get('text_status_3');
		$data['text_status_4'] = $this->language->get('text_status_4');
		$data['text_status_4'] = $this->language->get('text_status_4');
		$data['text_status_0'] = $this->language->get('text_status_0');

		$data['button_filter'] = $this->language->get('button_filter');

		$data['column_customer_search'] = $this->language->get('column_customer_search');

		$data['column_project_customer_search'] = $this->language->get('column_project_customer_search');
		$data['column_name'] = $this->language->get('column_name');
		$data['column_sort_order'] = $this->language->get('column_sort_order');
		$data['column_action'] = $this->language->get('column_action');
		//project
		$data['column_ckg_number'] = $this->language->get('column_ckg_number');
		$data['column_project_name'] = $this->language->get('column_project_name');
		$data['column_no_1'] = $this->language->get('column_no_1');
		$data['column_no_2'] = $this->language->get('column_no_2');
		$data['column_no_3'] = $this->language->get('column_no_3');
		$data['column_no_4'] = $this->language->get('column_no_4');
		$data['column_no_5'] = $this->language->get('column_no_5');
		$data['column_no_6'] = $this->language->get('column_no_6');
		$data['column_no_7'] = $this->language->get('column_no_7');
		$data['column_no_8'] = $this->language->get('column_no_8');
		$data['column_no_9'] = $this->language->get('column_no_9');
		$data['column_no_10'] = $this->language->get('column_no_10');
		$data['column_no_11'] = $this->language->get('column_no_11');
		$data['column_no_12'] = $this->language->get('column_no_12');
		$data['column_no_13'] = $this->language->get('column_no_13');
		$data['column_no_14'] = $this->language->get('column_no_14');
		$data['column_no_15'] = $this->language->get('column_no_15');
		$data['column_no_16'] = $this->language->get('column_no_16');
		$data['column_no_17'] = $this->language->get('column_no_17');
		$data['column_confirm'] = $this->language->get('column_confirm');
		$data['column_follow_up_history'] = $this->language->get('column_follow_up_history');
		$data['column_remark'] = $this->language->get('column_remark');
		$data['column_status'] = $this->language->get('column_status');

		$data['column_project_customer'] = $this->language->get('column_project_customer');
		$data['column_vendor_1'] = $this->language->get('column_vendor_1');
		$data['column_vendor_2'] = $this->language->get('column_vendor_2');
		$data['column_vendor_3'] = $this->language->get('column_vendor_3');
<<<<<<< HEAD
>>>>>>> d186f0ac043b98de93b00ad49075690d01e0cbaa
=======
>>>>>>> d186f0ac043b98de93b00ad49075690d01e0cbaa


		$data['button_add'] = $this->language->get('button_add');
		$data['button_edit'] = $this->language->get('button_edit');
		$data['button_delete'] = $this->language->get('button_delete');
		$data['button_rebuild'] = $this->language->get('button_rebuild');
<<<<<<< HEAD
<<<<<<< HEAD
		
		$data['wechat_status']     = $this->language->get('wechat_status');
=======

>>>>>>> d186f0ac043b98de93b00ad49075690d01e0cbaa
=======

>>>>>>> d186f0ac043b98de93b00ad49075690d01e0cbaa

		$data['token'] = $this->session->data['token'];

		if (isset($this->error['warning'])) {
			$data['error_warning'] = $this->error['warning'];
		} else {
			$data['error_warning'] = '';
		}

		if (isset($this->session->data['success'])) {
			$data['success'] = $this->session->data['success'];

			unset($this->session->data['success']);
		} else {
			$data['success'] = '';
		}

		if (isset($this->request->post['selected'])) {
			$data['selected'] = (array)$this->request->post['selected'];
		} else {
			$data['selected'] = array();
		}

		$url = '';



<<<<<<< HEAD
<<<<<<< HEAD
		if (isset($this->request->get['filter_customer_name'])) {
			$url .= '&filter_customer_name=' . urlencode(html_entity_decode($this->request->get['filter_customer_name'], ENT_QUOTES, 'UTF-8'));
		}

		if (isset($this->request->get['filter_admin_name'])) {
			$url .= '&filter_admin_name=' . urlencode(html_entity_decode($this->request->get['filter_admin_name'], ENT_QUOTES, 'UTF-8'));
		}

		if (isset($this->request->get['filter_admin_tel'])) {
			$url .= '&filter_admin_tel=' . urlencode(html_entity_decode($this->request->get['filter_admin_tel'], ENT_QUOTES, 'UTF-8'));
		}

		if (isset($this->request->get['filter_bank'])) {
			$url .= '&filter_bank=' . urlencode(html_entity_decode($this->request->get['filter_bank'], ENT_QUOTES, 'UTF-8'));
		}
		// if (isset($this->request->get['filter_customer_name']) && isset($this->request->get['filter_customer_value']) ) {
		// 	$url .= '&filter_customer_name=' . urlencode(html_entity_decode($this->request->get['filter_customer_name'], ENT_QUOTES, 'UTF-8'));
		// 	$url .= '&filter_customer_value=' . urlencode(html_entity_decode($this->request->get['filter_customer_value'], ENT_QUOTES, 'UTF-8'));
		// }
=======
=======
>>>>>>> d186f0ac043b98de93b00ad49075690d01e0cbaa
		if (isset($this->request->get['filter_ckg_number'])) {
			$url .= '&filter_ckg_number=' . urlencode(html_entity_decode($this->request->get['filter_ckg_number'], ENT_QUOTES, 'UTF-8'));
		}

		if (isset($this->request->get['filter_project_name'])) {
			$url .= '&filter_project_name=' . urlencode(html_entity_decode($this->request->get['filter_project_name'], ENT_QUOTES, 'UTF-8'));
		}

		if (isset($this->request->get['filter_english_name_of_supplier'])) {
			$url .= '&filter_english_name_of_supplier=' . urlencode(html_entity_decode($this->request->get['filter_english_name_of_supplier'], ENT_QUOTES, 'UTF-8'));
		}

		if (isset($this->request->get['filter_customer_name']) && isset($this->request->get['filter_customer_value']) ) {
			$url .= '&filter_customer_name=' . urlencode(html_entity_decode($this->request->get['filter_customer_name'], ENT_QUOTES, 'UTF-8'));
			$url .= '&filter_customer_value=' . urlencode(html_entity_decode($this->request->get['filter_customer_value'], ENT_QUOTES, 'UTF-8'));
		}
<<<<<<< HEAD
>>>>>>> d186f0ac043b98de93b00ad49075690d01e0cbaa
=======
>>>>>>> d186f0ac043b98de93b00ad49075690d01e0cbaa

		if (isset($this->request->get['filter_status'])) {
			$url .= '&filter_status=' . $this->request->get['filter_status'];
		}


		if ($order == 'ASC') {
			$url .= '&order=DESC';
		} else {
			$url .= '&order=ASC';
		}

		if (isset($this->request->get['page'])) {
			$url .= '&page=' . $this->request->get['page'];
		}

<<<<<<< HEAD
<<<<<<< HEAD
		$data['sort_customer_name'] = $this->url->link('hk/wechat_inland', 'token=' . $this->session->data['token'] . '&sort=customer_name' . $url, 'SSL');
		$data['sort_admin_name'] = $this->url->link('hk/wechat_inland', 'token=' . $this->session->data['token'] . '&sort=admin_name' . $url, 'SSL');
=======
		$data['sort_ckg_number'] = $this->url->link('hk/wechat_inland', 'token=' . $this->session->data['token'] . '&sort=ckg_number' . $url, 'SSL');
		$data['sort_project_name'] = $this->url->link('hk/wechat_inland', 'token=' . $this->session->data['token'] . '&sort=project_name' . $url, 'SSL');
>>>>>>> d186f0ac043b98de93b00ad49075690d01e0cbaa
=======
		$data['sort_ckg_number'] = $this->url->link('hk/wechat_inland', 'token=' . $this->session->data['token'] . '&sort=ckg_number' . $url, 'SSL');
		$data['sort_project_name'] = $this->url->link('hk/wechat_inland', 'token=' . $this->session->data['token'] . '&sort=project_name' . $url, 'SSL');
>>>>>>> d186f0ac043b98de93b00ad49075690d01e0cbaa
		$data['sort_status'] = $this->url->link('hk/wechat_inland', 'token=' . $this->session->data['token'] . '&sort=status' . $url, 'SSL');

		$url = '';

<<<<<<< HEAD
<<<<<<< HEAD
		if (isset($this->request->get['filter_customer_name'])) {
			$url .= '&filter_customer_name=' . urlencode(html_entity_decode($this->request->get['filter_customer_name'], ENT_QUOTES, 'UTF-8'));
		}

		if (isset($this->request->get['filter_admin_name'])) {
			$url .= '&filter_admin_name=' . urlencode(html_entity_decode($this->request->get['filter_admin_name'], ENT_QUOTES, 'UTF-8'));
		}

		if (isset($this->request->get['filter_admin_tel'])) {
			$url .= '&filter_admin_tel=' . urlencode(html_entity_decode($this->request->get['filter_admin_tel'], ENT_QUOTES, 'UTF-8'));
		}

		if (isset($this->request->get['filter_bank'])) {
			$url .= '&filter_bank=' . urlencode(html_entity_decode($this->request->get['filter_bank'], ENT_QUOTES, 'UTF-8'));
		}
		// if (isset($this->request->get['filter_customer_name']) && isset($this->request->get['filter_customer_value']) ) {
		// 	$url .= '&filter_customer_name=' . urlencode(html_entity_decode($this->request->get['filter_customer_name'], ENT_QUOTES, 'UTF-8'));
		// 	$url .= '&filter_customer_value=' . urlencode(html_entity_decode($this->request->get['filter_customer_value'], ENT_QUOTES, 'UTF-8'));
		// }
=======
=======
>>>>>>> d186f0ac043b98de93b00ad49075690d01e0cbaa
		if (isset($this->request->get['filter_ckg_number'])) {
			$url .= '&filter_ckg_number=' . urlencode(html_entity_decode($this->request->get['filter_ckg_number'], ENT_QUOTES, 'UTF-8'));
		}

		if (isset($this->request->get['filter_project_name'])) {
			$url .= '&filter_project_name=' . urlencode(html_entity_decode($this->request->get['filter_project_name'], ENT_QUOTES, 'UTF-8'));
		}

		if (isset($this->request->get['filter_english_name_of_supplier'])) {
			$url .= '&filter_english_name_of_supplier=' . urlencode(html_entity_decode($this->request->get['filter_english_name_of_supplier'], ENT_QUOTES, 'UTF-8'));
		}

		if (isset($this->request->get['filter_customer_name']) && isset($this->request->get['filter_customer_value']) ) {
			$url .= '&filter_customer_name=' . urlencode(html_entity_decode($this->request->get['filter_customer_name'], ENT_QUOTES, 'UTF-8'));
			$url .= '&filter_customer_value=' . urlencode(html_entity_decode($this->request->get['filter_customer_value'], ENT_QUOTES, 'UTF-8'));
		}
<<<<<<< HEAD
>>>>>>> d186f0ac043b98de93b00ad49075690d01e0cbaa
=======
>>>>>>> d186f0ac043b98de93b00ad49075690d01e0cbaa

		if (isset($this->request->get['filter_status'])) {
			$url .= '&filter_status=' . $this->request->get['filter_status'];
		}

		if (isset($this->request->get['sort'])) {
			$url .= '&sort=' . $this->request->get['sort'];
		}



		$pagination = new Pagination();
		$pagination->total = $category_total;
		$pagination->page = $page;
		$pagination->limit = $this->config->get('config_limit_admin');
		$pagination->url = $this->url->link('hk/wechat_inland', 'token=' . $this->session->data['token'] . $url . '&page={page}', 'SSL');

		$data['pagination'] = $pagination->render();

		$data['results'] = sprintf($this->language->get('text_pagination'), ($category_total) ? (($page - 1) * $this->config->get('config_limit_admin')) + 1 : 0, ((($page - 1) * $this->config->get('config_limit_admin')) > ($category_total - $this->config->get('config_limit_admin'))) ? $category_total : ((($page - 1) * $this->config->get('config_limit_admin')) + $this->config->get('config_limit_admin')), $category_total, ceil($category_total / $this->config->get('config_limit_admin')));

<<<<<<< HEAD
<<<<<<< HEAD
		$data['filter_customer_name'] = $filter_customer_name;
		$data['filter_admin_name'] = $filter_admin_name;
		$data['filter_admin_tel'] = $filter_admin_tel;
		$data['filter_bank'] = $filter_bank;
		// $data['filter_customer_value'] = $filter_customer_value;
		$data['filter_status'] = $filter_status;


=======
=======
>>>>>>> d186f0ac043b98de93b00ad49075690d01e0cbaa
		$data['filter_ckg_number'] = $filter_ckg_number;
		$data['filter_project_name'] = $filter_project_name;
		$data['filter_english_name_of_supplier'] = $filter_english_name_of_supplier;
		$data['filter_customer_name'] = $filter_customer_name;
		$data['filter_customer_value'] = $filter_customer_value;
		$data['filter_status'] = $filter_status;

<<<<<<< HEAD
>>>>>>> d186f0ac043b98de93b00ad49075690d01e0cbaa
=======
>>>>>>> d186f0ac043b98de93b00ad49075690d01e0cbaa
		$data['sort'] = $sort;
		$data['order'] = $order;

		$data['header'] = $this->load->controller('common/header');
		$data['column_left'] = $this->load->controller('common/column_left');
		$data['footer'] = $this->load->controller('common/footer');
		$data['status_all'] = $this->model_hk_wechat_inland->getProjectStatus();
		// var_dump(111);exit;
		$this->response->setOutput($this->load->view('hk/wechat_inland_list.tpl', $data));
	}

	protected function getForm() {
		$data['heading_title'] = $this->language->get('heading_title');

		$data['text_form'] = !isset($this->request->get['category_id']) ? $this->language->get('text_add') : $this->language->get('text_edit');
		$data['text_none'] = $this->language->get('text_none');
		$data['text_default'] = $this->language->get('text_default');
		$data['text_enabled'] = $this->language->get('text_enabled');
		$data['text_disabled'] = $this->language->get('text_disabled');

		$data['text_status_1'] = $this->language->get('text_status_1');
		$data['text_status_2'] = $this->language->get('text_status_2');
		$data['text_status_3'] = $this->language->get('text_status_3');
		$data['text_status_4'] = $this->language->get('text_status_4');
		$data['text_status_4'] = $this->language->get('text_status_4');
		$data['text_status_0'] = $this->language->get('text_status_0');

		$data['text_confirm_yes'] = $this->language->get('text_confirm_yes');
		$data['text_confirm_no'] = $this->language->get('text_confirm_no');

		$data['entry_upload'] = $this->language->get('entry_upload');
		$data['entry_overwrite'] = $this->language->get('entry_overwrite');
		$data['entry_progress'] = $this->language->get('entry_progress');

		$data['help_upload'] = $this->language->get('help_upload');

		$data['button_upload'] = $this->language->get('button_upload');
		$data['button_clear'] = $this->language->get('button_clear');
		$data['button_continue'] = $this->language->get('button_continue');

<<<<<<< HEAD
<<<<<<< HEAD
		//wechat_inland entry
		$data['entry_status']                    = $this->language->get('entry_status');
		$data['entry_no_1']                      = $this->language->get('entry_no_1');
		$data['entry_no_2']                      = $this->language->get('entry_no_2');
		$data['entry_no_3']                      = $this->language->get('entry_no_3');
		$data['entry_no_4']                      = $this->language->get('entry_no_4');
		$data['entry_customer_name']             = $this->language->get('entry_customer_name');
		$data['entry_admin_name']                = $this->language->get('entry_admin_name');
		$data['entry_admin_email']               = $this->language->get('entry_admin_email');
		$data['entry_admin_tel']                 = $this->language->get('entry_admin_tel');
		$data['entry_company_tel']               = $this->language->get('entry_company_tel');
		$data['entry_company_bank_account_name'] = $this->language->get('entry_company_bank_account_name');
		$data['entry_company_bank_account_num']  = $this->language->get('entry_company_bank_account_num');
		$data['entry_bank']                      = $this->language->get('entry_bank');
		$data['entry_wechat_login_name']         = $this->language->get('entry_wechat_login_name');
		$data['entry_wechat_login_password']     = $this->language->get('entry_wechat_login_password');


		$data['wechat_status']     = $this->language->get('wechat_status');
=======
=======
>>>>>>> d186f0ac043b98de93b00ad49075690d01e0cbaa
		$data['entry_vendor_quote_1'] = $this->language->get('entry_vendor_quote_1');
		$data['entry_vendor_quote_2'] = $this->language->get('entry_vendor_quote_2');
		$data['entry_vendor_quote_3'] = $this->language->get('entry_vendor_quote_3');


		$data['entry_ckg_number'] = $this->language->get('entry_ckg_number');
		$data['entry_project_name'] = $this->language->get('entry_project_name');
		$data['entry_no_1'] = $this->language->get('entry_no_1');
		$data['entry_no_2'] = $this->language->get('entry_no_2');
		$data['entry_no_3'] = $this->language->get('entry_no_3');
		$data['entry_no_4'] = $this->language->get('entry_no_4');
		$data['entry_no_5'] = $this->language->get('entry_no_5');
		$data['entry_no_6'] = $this->language->get('entry_no_6');
		$data['entry_no_7'] = $this->language->get('entry_no_7');
		$data['entry_no_8'] = $this->language->get('entry_no_8');
		$data['entry_no_9'] = $this->language->get('entry_no_9');
		$data['entry_no_10'] = $this->language->get('entry_no_10');
		$data['entry_no_11'] = $this->language->get('entry_no_11');
		$data['entry_no_12'] = $this->language->get('entry_no_12');
		$data['entry_no_13'] = $this->language->get('entry_no_13');
		$data['entry_no_14'] = $this->language->get('entry_no_14');
		$data['entry_no_15'] = $this->language->get('entry_no_15');
		$data['entry_no_16'] = $this->language->get('entry_no_16');
		$data['entry_no_17'] = $this->language->get('entry_no_17');
		$data['entry_confirm'] = $this->language->get('entry_confirm');

		$data['entry_submission_date'] = $this->language->get('entry_submission_date');
		$data['entry_approval_date'] = $this->language->get('entry_approval_date');
		$data['entry_agreement_date'] = $this->language->get('entry_agreement_date');
		$data['entry_date_for_submission_of_grant'] = $this->language->get('entry_date_for_submission_of_grant');
		$data['entry_grant_date'] = $this->language->get('entry_grant_date');

		$data['entry_follow_up_history'] = $this->language->get('entry_follow_up_history');
		$data['entry_remark'] = $this->language->get('entry_remark');
		$data['entry_status'] = $this->language->get('entry_status');

		$data['entry_project_customer'] = $this->language->get('entry_project_customer');


		$data['entry_vendor_1'] = $this->language->get('entry_vendor_1');
		$data['entry_vendor_2'] = $this->language->get('entry_vendor_2');
		$data['entry_vendor_3'] = $this->language->get('entry_vendor_3');


<<<<<<< HEAD
>>>>>>> d186f0ac043b98de93b00ad49075690d01e0cbaa
=======
>>>>>>> d186f0ac043b98de93b00ad49075690d01e0cbaa

		$data['button_save'] = $this->language->get('button_save');
		$data['button_cancel'] = $this->language->get('button_cancel');

		$data['tab_general'] = $this->language->get('tab_general');
		$data['tab_data'] = $this->language->get('tab_data');
		$data['tab_design'] = $this->language->get('tab_design');

		if (isset($this->error['warning'])) {
			$data['error_warning'] = $this->error['warning'];
		} else {
			$data['error_warning'] = '';
		}

<<<<<<< HEAD
<<<<<<< HEAD
		if (isset($this->error['customer_name'])) {
			$data['error_customer_name'] = $this->error['customer_name'];
		} else {
			$data['error_customer_name'] = null;
		}

=======
=======
>>>>>>> d186f0ac043b98de93b00ad49075690d01e0cbaa
		if (isset($this->error['ckg_number'])) {
			$data['error_ckg_number'] = $this->error['ckg_number'];
		} else {
			$data['error_ckg_number'] = null;
		}
		if (isset($this->error['project_name'])) {
			$data['error_project_name'] = $this->error['project_name'];
		} else {
			$data['error_project_name'] = null;
		}
		if (isset($this->error['name'])) {
			$data['error_name'] = $this->error['name'];
		} else {
			$data['error_name'] = null;
		}

		if (isset($this->error['vendor_details_1'])) {
			$data['error_vendor_details_1'] = $this->error['vendor_details_1'];
		} else {
			$data['error_vendor_details_1'] = null;
		}

		if (isset($this->error['vendor_details_2'])) {
			$data['error_vendor_details_2'] = $this->error['vendor_details_2'];
		} else {
			$data['error_vendor_details_2'] = null;
		}

		if (isset($this->error['vendor_details_3'])) {
			$data['error_vendor_details_3'] = $this->error['vendor_details_3'];
		} else {
			$data['error_vendor_details_3'] = null;
		}
		if (isset($this->error['vendor_1'])) {
			$data['error_vendor_1'] = $this->error['vendor_1'];
		} else {
			$data['error_vendor_1'] = null;
		}

		if (isset($this->error['vendor_2'])) {
			$data['error_vendor_2'] = $this->error['vendor_2'];
		} else {
			$data['error_vendor_2'] = null;
		}

		if (isset($this->error['vendor_3'])) {
			$data['error_vendor_3'] = $this->error['vendor_3'];
		} else {
			$data['error_vendor_3'] = null;
		}

		if (isset($this->error['vendor_quote_1'])) {
			$data['error_vendor_quote_1'] = $this->error['vendor_quote_1'];
		} else {
			$data['error_vendor_quote_1'] = null;
		}
		if (isset($this->error['vendor_quote_2'])) {
			$data['error_vendor_quote_2'] = $this->error['vendor_quote_2'];
		} else {
			$data['error_vendor_quote_2'] = null;
		}
		if (isset($this->error['vendor_quote_3'])) {
			$data['error_vendor_quote_3'] = $this->error['vendor_quote_3'];
		} else {
			$data['error_vendor_quote_3'] = null;
		}
<<<<<<< HEAD
>>>>>>> d186f0ac043b98de93b00ad49075690d01e0cbaa
=======
>>>>>>> d186f0ac043b98de93b00ad49075690d01e0cbaa


		$url = '';
		if (isset($this->request->get['filter_ckg_number'])) {
			$url .= '&filter_ckg_number=' . urlencode(html_entity_decode($this->request->get['filter_ckg_number'], ENT_QUOTES, 'UTF-8'));
		}

		if (isset($this->request->get['filter_project_name'])) {
			$url .= '&filter_project_name=' . urlencode(html_entity_decode($this->request->get['filter_project_name'], ENT_QUOTES, 'UTF-8'));
		}

		if (isset($this->request->get['filter_english_name_of_supplier'])) {
			$url .= '&filter_english_name_of_supplier=' . urlencode(html_entity_decode($this->request->get['filter_english_name_of_supplier'], ENT_QUOTES, 'UTF-8'));
		}

		if (isset($this->request->get['filter_customer_name']) && isset($this->request->get['filter_customer_value']) ) {
			$url .= '&filter_customer_name=' . urlencode(html_entity_decode($this->request->get['filter_customer_name'], ENT_QUOTES, 'UTF-8'));
			$url .= '&filter_customer_value=' . urlencode(html_entity_decode($this->request->get['filter_customer_value'], ENT_QUOTES, 'UTF-8'));
		}

		if (isset($this->request->get['filter_status'])) {
			$url .= '&filter_status=' . $this->request->get['filter_status'];
		}

		if (isset($this->request->get['sort'])) {
			$url .= '&sort=' . $this->request->get['sort'];
		}

		if (isset($this->request->get['order'])) {
			$url .= '&order=' . $this->request->get['order'];
		}

		if (isset($this->request->get['page'])) {
			$url .= '&page=' . $this->request->get['page'];
		}

		$data['breadcrumbs'] = array();

		$data['breadcrumbs'][] = array(
			'text' => $this->language->get('text_home'),
			'href' => $this->url->link('common/dashboard', 'token=' . $this->session->data['token'], 'SSL')
		);

		$data['breadcrumbs'][] = array(
			'text' => $this->language->get('heading_title'),
			'href' => $this->url->link('hk/wechat_inland', 'token=' . $this->session->data['token'] . $url, 'SSL')
		);

<<<<<<< HEAD
<<<<<<< HEAD
		if (!isset($this->request->get['wechat_id'])) {
			$data['action'] = $this->url->link('hk/wechat_inland/add', 'token=' . $this->session->data['token'] . $url, 'SSL');
			$data['wechat_id'] = '';
		} else {
			$data['action'] = $this->url->link('hk/wechat_inland/edit', 'token=' . $this->session->data['token'] . '&wechat_id=' . $this->request->get['wechat_id'] . $url, 'SSL');
			$data['wechat_id'] = $this->request->get['wechat_id'];
=======
=======
>>>>>>> d186f0ac043b98de93b00ad49075690d01e0cbaa
		if (!isset($this->request->get['project_progress_id'])) {
			$data['action'] = $this->url->link('hk/wechat_inland/add', 'token=' . $this->session->data['token'] . $url, 'SSL');
			$data['project_progress_id'] = '';
		} else {
			$data['action'] = $this->url->link('hk/wechat_inland/edit', 'token=' . $this->session->data['token'] . '&project_progress_id=' . $this->request->get['project_progress_id'] . $url, 'SSL');
			$data['project_progress_id'] = $this->request->get['project_progress_id'];
<<<<<<< HEAD
>>>>>>> d186f0ac043b98de93b00ad49075690d01e0cbaa
=======
>>>>>>> d186f0ac043b98de93b00ad49075690d01e0cbaa
		}

		$data['cancel'] = $this->url->link('hk/wechat_inland', 'token=' . $this->session->data['token'] . $url, 'SSL');

<<<<<<< HEAD
<<<<<<< HEAD
		if (isset($this->request->get['wechat_id']) && ($this->request->server['REQUEST_METHOD'] != 'POST')) {
			$wecaht_info = $this->model_hk_wechat_inland->getWecahtInland($this->request->get['wechat_id']);
		}

=======
=======
>>>>>>> d186f0ac043b98de93b00ad49075690d01e0cbaa
		if (isset($this->request->get['project_progress_id']) && ($this->request->server['REQUEST_METHOD'] != 'POST')) {
			$category_info = $this->model_hk_wechat_inland->getVendors($this->request->get['project_progress_id']);
		}
		// var_dump($category_info);exit;
<<<<<<< HEAD
>>>>>>> d186f0ac043b98de93b00ad49075690d01e0cbaa
=======
>>>>>>> d186f0ac043b98de93b00ad49075690d01e0cbaa
		$data['token'] = $this->session->data['token'];

		$this->load->model('localisation/language');

		$data['languages'] = $this->model_localisation_language->getLanguages();

<<<<<<< HEAD
<<<<<<< HEAD
		if (isset($this->request->post['customer_name'])) {
			$data['customer_name'] = $this->request->post['customer_name'];
		} elseif (!empty($wecaht_info)) {
			$data['customer_name'] = $wecaht_info['customer_name'];
		} else {
			$data['customer_name'] = '';
		}

		if (isset($this->request->post['admin_name'])) {
			$data['admin_name'] = $this->request->post['admin_name'];
		} elseif (!empty($wecaht_info)) {
			$data['admin_name'] = $wecaht_info['admin_name'];
		} else {
			$data['admin_name'] = '';
		}

		if (isset($this->request->post['admin_email'])) {
			$data['admin_email'] = $this->request->post['admin_email'];
		} elseif (!empty($wecaht_info)) {
			$data['admin_email'] = $wecaht_info['admin_email'];
		} else {
			$data['admin_email'] = '';
		}

		if (isset($this->request->post['admin_tel'])) {
			$data['admin_tel'] = $this->request->post['admin_tel'];
		} elseif (!empty($wecaht_info)) {
			$data['admin_tel'] = $wecaht_info['admin_tel'];
		} else {
			$data['admin_tel'] = '';
		}

		if (isset($this->request->post['company_tel'])) {
			$data['company_tel'] = $this->request->post['company_tel'];
		} elseif (!empty($wecaht_info)) {
			$data['company_tel'] = $wecaht_info['company_tel'];
		} else {
			$data['company_tel'] = '';
		}

		if (isset($this->request->post['company_bank_account_name'])) {
			$data['company_bank_account_name'] = $this->request->post['company_bank_account_name'];
		} elseif (!empty($wecaht_info)) {
			$data['company_bank_account_name'] = $wecaht_info['company_bank_account_name'];
		} else {
			$data['company_bank_account_name'] = '';
		}

		if (isset($this->request->post['company_bank_account_num'])) {
			$data['company_bank_account_num'] = $this->request->post['company_bank_account_num'];
		} elseif (!empty($wecaht_info)) {
			$data['company_bank_account_num'] = $wecaht_info['company_bank_account_num'];
		} else {
			$data['company_bank_account_num'] = '';
		}

		if (isset($this->request->post['bank'])) {
			$data['bank'] = $this->request->post['bank'];
		} elseif (!empty($wecaht_info)) {
			$data['bank'] = $wecaht_info['bank'];
		} else {
			$data['bank'] = '';
		}

		if (isset($this->request->post['wechat_login_name'])) {
			$data['wechat_login_name'] = $this->request->post['wechat_login_name'];
		} elseif (!empty($wecaht_info)) {
			$data['wechat_login_name'] = $wecaht_info['wechat_login_name'];
		} else {
			$data['wechat_login_name'] = '';
		}

		if (isset($this->request->post['wechat_login_password'])) {
			$data['wechat_login_password'] = $this->request->post['wechat_login_password'];
		} elseif (!empty($wecaht_info)) {
			$data['wechat_login_password'] = $wecaht_info['wechat_login_password'];
		} else {
			$data['wechat_login_password'] = '';
		}

		if(isset($this->request->post['no_1_child'])){
			// var_dump($this->request->post);exit;
			$data['no_1_childs'] = $this->model_hk_wechat_inland->getWechatFiles($this->request->post['no_1_child']);
		} elseif (!empty($wecaht_info)) {
			if(!empty($wecaht_info['data']['no_1'])){
				$data['no_1_childs'] = $wecaht_info['data']['no_1'];
			}else{
				$data['no_1_childs'] = null;
			}
		}else{
			$data['no_1_childs'] = null;
		}

		if(isset($this->request->post['no_2_child'])){
			// var_dump($this->request->post);exit;
			$data['no_2_childs'] = $this->model_hk_wechat_inland->getWechatFiles($this->request->post['no_2_child']);
		} elseif (!empty($wecaht_info)) {
			if(!empty($wecaht_info['data']['no_2'])){
				$data['no_2_childs'] = $wecaht_info['data']['no_2'];
			}else{
				$data['no_2_childs'] = null;
			}
		}else{
			$data['no_2_childs'] = null;
		}

		if(isset($this->request->post['no_3_child'])){
			// var_dump($this->request->post);exit;
			$data['no_3_childs'] = $this->model_hk_wechat_inland->getWechatFiles($this->request->post['no_3_child']);
		} elseif (!empty($wecaht_info)) {
			if(!empty($wecaht_info['data']['no_3'])){
				$data['no_3_childs'] = $wecaht_info['data']['no_3'];
			}else{
				$data['no_3_childs'] = null;
			}
		}else{
			$data['no_3_childs'] = null;
		}

		if(isset($this->request->post['no_4_child'])){
			// var_dump($this->request->post);exit;
			$data['no_4_childs'] = $this->model_hk_wechat_inland->getWechatFiles($this->request->post['no_4_child']);
		} elseif (!empty($wecaht_info)) {
			if(!empty($wecaht_info['data']['no_4'])){
				$data['no_4_childs'] = $wecaht_info['data']['no_4'];
			}else{
				$data['no_4_childs'] = null;
			}
		}else{
			$data['no_4_childs'] = null;
=======
=======
>>>>>>> d186f0ac043b98de93b00ad49075690d01e0cbaa
		if (isset($this->request->post['ckg_number'])) {
			$data['ckg_number'] = $this->request->post['ckg_number'];
		} elseif (!empty($category_info)) {
			$data['ckg_number'] = $category_info['ckg_number'];
		} else {
			$data['ckg_number'] = '';
		}

		if (isset($this->request->post['project_name'])) {
			$data['project_name'] = $this->request->post['project_name'];
		} elseif (!empty($category_info)) {
			$data['project_name'] = $category_info['project_name'];
		} else {
			$data['project_name'] = '';
		}

		if(isset($this->request->post['no_1_child'])){
			// var_dump($this->request->post);exit;
			$data['no_1_childs'] = $this->model_hk_wechat_inland->getProjectFiles($this->request->post['no_1_child']);
		} elseif (!empty($category_info)) {
			if(!empty($category_info['data']['no_1'])){
				$data['no_1_childs'] = $category_info['data']['no_1'];
			}else{
				$data['no_1_childs'] = null;
			}
		}else{
			$data['no_1_childs'] = null;
		}

		if(isset($this->request->post['no_5_child'])){
			// var_dump($this->request->post);exit;
			$data['no_5_childs'] = $this->model_hk_wechat_inland->getProjectFiles($this->request->post['no_5_child']);
		} elseif (!empty($category_info)) {
			if(!empty($category_info['data']['no_5'])){
				$data['no_5_childs'] = $category_info['data']['no_5'];
			}else{
				$data['no_5_childs'] = null;
			}
		}else{
			$data['no_5_childs'] = null;
		}

		if(isset($this->request->post['no_6_child'])){
			// var_dump($this->request->post);exit;
			$data['no_6_childs'] = $this->model_hk_wechat_inland->getProjectFiles($this->request->post['no_6_child']);
		} elseif (!empty($category_info)) {
			if(!empty($category_info['data']['no_6'])){
				$data['no_6_childs'] = $category_info['data']['no_6'];
			}else{
				$data['no_6_childs'] = null;
			}
		}else{
			$data['no_6_childs'] = null;
		}

		if(isset($this->request->post['no_7_child'])){
			// var_dump($this->request->post);exit;
			$data['no_7_childs'] = $this->model_hk_wechat_inland->getProjectFiles($this->request->post['no_7_child']);
		} elseif (!empty($category_info)) {
			if(!empty($category_info['data']['no_7'])){
				$data['no_7_childs'] = $category_info['data']['no_7'];
			}else{
				$data['no_7_childs'] = null;
			}
		}else{
			$data['no_7_childs'] = null;
		}
		
		if(isset($this->request->post['no_8_child'])){
			// var_dump($this->request->post);exit;
			$data['no_8_childs'] = $this->model_hk_wechat_inland->getProjectFiles($this->request->post['no_8_child']);
		} elseif (!empty($category_info)) {
			if(!empty($category_info['data']['no_8'])){
				$data['no_8_childs'] = $category_info['data']['no_8'];
			}else{
				$data['no_8_childs'] = null;
			}
		}else{
			$data['no_8_childs'] = null;
		}

		if(isset($this->request->post['no_9_child'])){
			// var_dump($this->request->post);exit;
			$data['no_9_childs'] = $this->model_hk_wechat_inland->getProjectFiles($this->request->post['no_9_child']);
		} elseif (!empty($category_info)) {
			if(!empty($category_info['data']['no_9'])){
				$data['no_9_childs'] = $category_info['data']['no_9'];
			}else{
				$data['no_9_childs'] = null;
			}
		}else{
			$data['no_9_childs'] = null;
		}

		if(isset($this->request->post['no_10_child'])){
			// var_dump($this->request->post);exit;
			$data['no_10_childs'] = $this->model_hk_wechat_inland->getProjectFiles($this->request->post['no_10_child']);
		} elseif (!empty($category_info)) {
			if(!empty($category_info['data']['no_10'])){
				$data['no_10_childs'] = $category_info['data']['no_10'];
			}else{
				$data['no_10_childs'] = null;
			}
		}else{
			$data['no_10_childs'] = null;
		}

		if(isset($this->request->post['no_11_child'])){
			// var_dump($this->request->post);exit;
			$data['no_11_childs'] = $this->model_hk_wechat_inland->getProjectFiles($this->request->post['no_11_child']);
		} elseif (!empty($category_info)) {
			if(!empty($category_info['data']['no_11'])){
				$data['no_11_childs'] = $category_info['data']['no_11'];
			}else{
				$data['no_11_childs'] = null;
			}
		}else{
			$data['no_11_childs'] = null;
		}

		if(isset($this->request->post['no_12_child'])){
			// var_dump($this->request->post);exit;
			$data['no_12_childs'] = $this->model_hk_wechat_inland->getProjectFiles($this->request->post['no_12_child']);
		} elseif (!empty($category_info)) {
			if(!empty($category_info['data']['no_12'])){
				$data['no_12_childs'] = $category_info['data']['no_12'];
			}else{
				$data['no_12_childs'] = null;
			}
		}else{
			$data['no_12_childs'] = null;
		}

		if(isset($this->request->post['no_13_child'])){
			// var_dump($this->request->post);exit;
			$data['no_13_childs'] = $this->model_hk_wechat_inland->getProjectFiles($this->request->post['no_13_child']);
		} elseif (!empty($category_info)) {
			if(!empty($category_info['data']['no_13'])){
				$data['no_13_childs'] = $category_info['data']['no_13'];
			}else{
				$data['no_13_childs'] = null;
			}
		}else{
			$data['no_13_childs'] = null;
		}

		// if(isset($this->request->post['no_14_child'])){
		// 	// var_dump($this->request->post);exit;
		// 	$data['no_14_childs'] = $this->model_hk_wechat_inland->getProjectFiles($this->request->post['no_14_child']);
		// } elseif (!empty($category_info)) {
		// 	if(!empty($category_info['data']['no_14'])){
		// 		$data['no_14_childs'] = $category_info['data']['no_14'];
		// 	}else{
		// 		$data['no_14_childs'] = null;
		// 	}
		// }else{
		// 	$data['no_14_childs'] = null;
		// }

		// if(isset($this->request->post['no_15_child'])){
		// 	// var_dump($this->request->post);exit;
		// 	$data['no_15_childs'] = $this->model_hk_wechat_inland->getProjectFiles($this->request->post['no_15_child']);
		// } elseif (!empty($category_info)) {
		// 	if(!empty($category_info['data']['no_15'])){
		// 		$data['no_15_childs'] = $category_info['data']['no_15'];
		// 	}else{
		// 		$data['no_15_childs'] = null;
		// 	}
		// }else{
		// 	$data['no_15_childs'] = null;
		// }

		if(isset($this->request->post['no_16_child'])){
			// var_dump($this->request->post);exit;
			$data['no_16_childs'] = $this->model_hk_wechat_inland->getProjectFiles($this->request->post['no_16_child']);
		} elseif (!empty($category_info)) {
			if(!empty($category_info['data']['no_16'])){
				$data['no_16_childs'] = $category_info['data']['no_16'];
			}else{
				$data['no_16_childs'] = null;
			}
		}else{
			$data['no_16_childs'] = null;
		}

		if(isset($this->request->post['no_17_child'])){
			// var_dump($this->request->post);exit;
			$data['no_17_childs'] = $this->model_hk_wechat_inland->getProjectFiles($this->request->post['no_17_child']);
		} elseif (!empty($category_info)) {
			if(!empty($category_info['data']['no_17'])){
				$data['no_17_childs'] = $category_info['data']['no_17'];
			}else{
				$data['no_17_childs'] = null;
			}
		}else{
			$data['no_17_childs'] = null;
		}


		if (isset($this->request->post['no_2'])) {
			$data['no_2'] = $this->request->post['no_2'];
		} elseif (!empty($category_info)) {
			$data['no_2'] = (!empty($category_info['no_2']))?date("Y-m-d",(int)$category_info['no_2']):'';
		} else {
			$data['no_2'] = '';
		}

		if (isset($this->request->post['no_3'])) {
			$data['no_3'] = $this->request->post['no_3'];
		} elseif (!empty($category_info)) {
			$data['no_3'] = $category_info['no_3'];
		} else {
			$data['no_3'] = '';
		}
		if (isset($this->request->post['no_4'])) {
			$data['no_4'] = $this->request->post['no_4'];
		} elseif (!empty($category_info)) {
			$data['no_4'] = $category_info['no_4'];

		} else {
			$data['no_4'] = '';
		}
		
		
		if (isset($this->request->post['submission_date'])) {
			$data['submission_date'] = $this->request->post['submission_date'];
		} elseif (!empty($category_info)) {
			$data['submission_date'] = (!empty($category_info['submission_date']))?date("Y-m-d",(int)$category_info['submission_date']):'';
		} else {
			$data['submission_date'] = '';
		}

		if (isset($this->request->post['approval_date'])) {
			$data['approval_date'] = $this->request->post['approval_date'];
		} elseif (!empty($category_info)) {
			$data['approval_date'] = (!empty($category_info['approval_date']))?date("Y-m-d",(int)$category_info['approval_date']):'';
		} else {
			$data['approval_date'] = '';
		}

		if (isset($this->request->post['agreement_date'])) {
			$data['agreement_date'] = $this->request->post['agreement_date'];
		} elseif (!empty($category_info)) {
			$data['agreement_date'] = (!empty($category_info['agreement_date']))?date("Y-m-d",(int)$category_info['agreement_date']):'';
		} else {
			$data['agreement_date'] = '';
		}

		if (isset($this->request->post['date_for_submission_of_grant'])) {
			$data['date_for_submission_of_grant'] = $this->request->post['date_for_submission_of_grant'];
		} elseif (!empty($category_info)) {
			$data['date_for_submission_of_grant'] = (!empty($category_info['date_for_submission_of_grant']))?date("Y-m-d",(int)$category_info['date_for_submission_of_grant']):'';
		} else {
			$data['date_for_submission_of_grant'] = '';
		}

		if (isset($this->request->post['grant_date'])) {
			$data['grant_date'] = $this->request->post['grant_date'];
		} elseif (!empty($category_info)) {
			$data['grant_date'] = (!empty($category_info['grant_date']))?date("Y-m-d",(int)$category_info['grant_date']):'';
		} else {
			$data['grant_date'] = '';
		}




		if (isset($this->request->post['follow_up_history'])) {
			$data['follow_up_history'] = $this->request->post['follow_up_history'];
		} elseif (!empty($category_info)) {
			$data['follow_up_history'] = $category_info['follow_up_history'];
		} else {
			$data['follow_up_history'] = null;
		}

		// if (isset($this->request->post['remark'])) {
		// 	$data['remark'] = $this->request->post['remark'];
		// }else {
		// 	$data['remark'] = null;
		// }

		if (isset($this->request->post['remark'])) {
			$data['remark'] = $this->request->post['remark'];
		} elseif (!empty($category_info)) {
			$data['remark'] = $category_info['remark'];
		} else {
			$data['remark'] = null;
<<<<<<< HEAD
>>>>>>> d186f0ac043b98de93b00ad49075690d01e0cbaa
=======
>>>>>>> d186f0ac043b98de93b00ad49075690d01e0cbaa
		}

		if (isset($this->request->post['status'])) {
			$data['status'] = $this->request->post['status'];
<<<<<<< HEAD
<<<<<<< HEAD
		} elseif (!empty($wecaht_info)) {
			$data['status'] = $wecaht_info['status'];
		} else {
			$data['status'] = '';
		}



=======
=======
>>>>>>> d186f0ac043b98de93b00ad49075690d01e0cbaa
		} elseif (!empty($category_info)) {
			$data['status'] = $category_info['status'];
		} else {
			$data['status'] = '';
		}
		if (isset($this->request->post['confirm'])) {
			$data['confirm'] = $this->request->post['confirm'];
		} elseif (!empty($category_info)) {
			$data['confirm'] = $category_info['confirm'];
		} else {
			$data['confirm'] = '';
		}

		if (isset($this->request->post['project_customer'])) {
			$data['project_customer'] = $this->request->post['project_customer'];
			$data['project_customer_id'] = $this->request->post['project_customer_id'];

		} elseif (!empty($category_info)) {
			$data['project_customer'] = $category_info['data']['project_customer'];
			$data['project_customer_id'] = $category_info['project_customer_id'];
		} else {
			$data['project_customer'] = '';
			$data['project_customer_id'] = '';
		}



		if (isset($this->request->post['vendor_1'])) {
			$data['vendor_1'] = $this->request->post['vendor_1'];
			$data['vendor_1_id'] = $this->request->post['vendor_1_id'];
		} elseif (!empty($category_info)) {
			$data['vendor_1'] = $category_info['data']['vendor_1'];
			$data['vendor_1_id'] = $category_info['vendor_details_id_1'];
		} else {
			$data['vendor_1'] = '';
			$data['vendor_1_id'] = '';
		}

		if (isset($this->request->post['vendor_2'])) {
			$data['vendor_2'] = $this->request->post['vendor_2'];
			$data['vendor_2_id'] = $this->request->post['vendor_2_id'];
		} elseif (!empty($category_info)) {
			$data['vendor_2'] = $category_info['data']['vendor_2'];
			$data['vendor_2_id'] = $category_info['vendor_details_id_2'];

		} else {
			$data['vendor_2'] = '';
			$data['vendor_2_id'] = '';
		}

		if (isset($this->request->post['vendor_3'])) {
			$data['vendor_3'] = $this->request->post['vendor_3'];
			$data['vendor_3_id'] = $this->request->post['vendor_3_id'];
		} elseif (!empty($category_info)) {
			$data['vendor_3'] = $category_info['data']['vendor_3'];
			$data['vendor_3_id'] = $category_info['vendor_details_id_3'];
		} else {
			$data['vendor_3'] = '';
			$data['vendor_3_id'] = '';
		}

		if (isset($this->request->post['vendor_quote_1'])) {
			$data['vendor_quote_1'] = $this->request->post['vendor_quote_1'];

		} elseif (!empty($category_info)) {
			// $data['vendor_quote_1'] = $category_info['data']['vendor_quote_1'];

			$data['vendor_quote_1'] = (!empty($category_info['vendor_quote_1']))?number_format($category_info['vendor_quote_1']):'';

		} else {
			$data['vendor_quote_1'] = '';

		}
		if (isset($this->request->post['vendor_quote_2'])) {
			$data['vendor_quote_2'] = $this->request->post['vendor_quote_2'];
			
		} elseif (!empty($category_info)) {

			$data['vendor_quote_2'] = (!empty($category_info['vendor_quote_2']))?number_format($category_info['vendor_quote_2']):'';
			
		} else {
			$data['vendor_quote_2'] = '';

		}

		if (isset($this->request->post['vendor_quote_3'])) {
			$data['vendor_quote_3'] = $this->request->post['vendor_quote_3'];

		} elseif (!empty($category_info)) {

			$data['vendor_quote_3'] = (!empty($category_info['vendor_quote_3']))?number_format($category_info['vendor_quote_3']):'';

		} else {
			$data['vendor_quote_3'] = '';

		}
<<<<<<< HEAD
>>>>>>> d186f0ac043b98de93b00ad49075690d01e0cbaa
=======
>>>>>>> d186f0ac043b98de93b00ad49075690d01e0cbaa

		$data['status_all'] = $this->model_hk_wechat_inland->getProjectStatus();

		$data['header'] = $this->load->controller('common/header');
		$data['column_left'] = $this->load->controller('common/column_left');
		$data['footer'] = $this->load->controller('common/footer');

		$this->response->setOutput($this->load->view('hk/wechat_inland_form.tpl', $data));
	}

	protected function validateForm() {

<<<<<<< HEAD
<<<<<<< HEAD
		if ((utf8_strlen(trim($this->request->post['customer_name'])) < 1) || (utf8_strlen(trim($this->request->post['customer_name'])) > 200)) {
			$this->error['customer_name'] = $this->language->get('error_project_name');
		}

=======
=======
>>>>>>> d186f0ac043b98de93b00ad49075690d01e0cbaa
		if ((utf8_strlen(trim($this->request->post['project_name'])) < 1) || (utf8_strlen(trim($this->request->post['project_name'])) > 200)) {
			$this->error['project_name'] = $this->language->get('error_project_name');
		}


		($this->request->post['vendor_1'] == '--- None ---')? $this->request->post['vendor_1_id'] = '': '';
		($this->request->post['vendor_2'] == '--- None ---')? $this->request->post['vendor_2_id'] = '': '';
		($this->request->post['vendor_3'] == '--- None ---')? $this->request->post['vendor_3_id'] = '': '';
		$vendor_1 = (isset($this->request->post['vendor_1_id']))?$this->request->post['vendor_1_id']:'';
		$vendor_2 =	(isset($this->request->post['vendor_2_id']))?$this->request->post['vendor_2_id']:'';
		$vendor_3 =	(isset($this->request->post['vendor_3_id']))?$this->request->post['vendor_3_id']:'';
		if($vendor_1){
			if($vendor_1 == $vendor_2){
				$this->error['vendor_1'] = $this->language->get('error_vendor_1');
			}
			if($vendor_1 == $vendor_3){
				$this->error['vendor_1'] = $this->language->get('error_vendor_1');
			}
		}
		if($vendor_2){
			if($vendor_2 == $vendor_1){
				$this->error['vendor_2'] = $this->language->get('error_vendor_2');
			}
			if($vendor_2 == $vendor_3){
				$this->error['vendor_2'] = $this->language->get('error_vendor_2');
			}
		}
		if($vendor_3){
			if($vendor_3 == $vendor_2){
				$this->error['vendor_3'] = $this->language->get('error_vendor_3');
			}
			if($vendor_3 == $vendor_1){
				$this->error['vendor_3'] = $this->language->get('error_vendor_3');
			}
		}
		$vendor_quote_1 = (isset($this->request->post['vendor_quote_1']))?str_replace(',','',$this->request->post['vendor_quote_1']):'';
		$vendor_quote_2 = (isset($this->request->post['vendor_quote_2']))?str_replace(',','',$this->request->post['vendor_quote_2']):'';
		$vendor_quote_3 = (isset($this->request->post['vendor_quote_3']))?str_replace(',','',$this->request->post['vendor_quote_3']):'';
		if(!empty($vendor_quote_1)){
			if($vendor_quote_1 >= 300000){
				$this->error['vendor_quote_1'] = $this->language->get('error_vendor_quote_1');
			}else if (!empty($vendor_quote_2) && $vendor_quote_1 > $vendor_quote_2 ){
				$this->error['vendor_quote_1'] = $this->language->get('error_vendor_quote_1_1');
			}else if (!empty($vendor_quote_3) && $vendor_quote_1 > $vendor_quote_3 ){
				$this->error['vendor_quote_1'] = $this->language->get('error_vendor_quote_1_2');
			}
			
		}

		$this->load->model('vendor/vendor_checklist');
		$a = $this->model_vendor_vendor_checklist->checkData($vendor_1,$vendor_2,$vendor_3);
		if($a == 1){
			$this->error['vendor_details_1'] = $this->language->get('error_vendor_details_1');
		}else if($a == 2){
			$this->error['vendor_details_2'] = $this->language->get('error_vendor_details_2');
		}else if($a == 3){
			$this->error['vendor_details_3'] = $this->language->get('error_vendor_details_3');
		}
<<<<<<< HEAD
>>>>>>> d186f0ac043b98de93b00ad49075690d01e0cbaa
=======
>>>>>>> d186f0ac043b98de93b00ad49075690d01e0cbaa
		
		return !$this->error;
	}

<<<<<<< HEAD
<<<<<<< HEAD
=======
=======
>>>>>>> d186f0ac043b98de93b00ad49075690d01e0cbaa
	protected function validateDelete() {
		if (!$this->user->hasPermission('modify', 'hk/wechat_inland')) {
			$this->error['warning'] = $this->language->get('error_permission');
		}

		return !$this->error;
	}
<<<<<<< HEAD
>>>>>>> d186f0ac043b98de93b00ad49075690d01e0cbaa
=======
>>>>>>> d186f0ac043b98de93b00ad49075690d01e0cbaa

	protected function validateRepair() {
		if (!$this->user->hasPermission('modify', 'hk/wechat_inland')) {
			$this->error['warning'] = $this->language->get('error_permission');
		}

		return !$this->error;
	}
	public function autocomplete() {
		$json = array();

		if (isset($this->request->get['filter_ckg_number']) || isset($this->request->get['filter_project_name']) ) {
			$this->load->model('hk/wechat_inland');
			if (isset($this->request->get['filter_ckg_number'])) {
				$filter_ckg_number = $this->request->get['filter_ckg_number'];
			} else {
				$filter_ckg_number = '';
			}

			if (isset($this->request->get['filter_project_name'])) {
				$filter_project_name = $this->request->get['filter_project_name'];
			} else {
				$filter_project_name = '';
			}

			if (isset($this->request->get['limit'])) {
				$limit = $this->request->get['limit'];
			} else {
				$limit = 5;
			}

			$filter_data = array(
				'filter_ckg_number'  => $filter_ckg_number,
				'filter_project_name' => $filter_project_name,
				'start'        => 0,
				'limit'        => $limit
			);

			$results = $this->model_hk_wechat_inland->getVendorChecklists($filter_data);
			// var_dump($results);exit;
			foreach ($results as $result) {
				$json[] = array(
					'project_progress_id' => $result['project_progress_id'],
					'ckg_number'        => strip_tags(html_entity_decode($result['ckg_number'], ENT_QUOTES, 'UTF-8')),
					'project_name'        => strip_tags(html_entity_decode($result['project_name'], ENT_QUOTES, 'UTF-8'))
				);
			}
		}



		$this->response->addHeader('Content-Type: application/json');
		$this->response->setOutput(json_encode($json));
	}

<<<<<<< HEAD
<<<<<<< HEAD
=======
=======
>>>>>>> d186f0ac043b98de93b00ad49075690d01e0cbaa
	public function autocomplete2() {
		$json = array();

		if (isset($this->request->get['filter_name'])) {
			$this->load->model('hk/wechat_inland');

			$filter_data = array(
				'filter_name' => $this->request->get['filter_name'],
				'sort'        => 'name',
				'order'       => 'ASC',
				'start'       => 0,
				'limit'       => 5
			);

			$results = $this->model_hk_wechat_inland->getPojectCustomers($filter_data);

			foreach ($results as $result) {
				$json[] = array(
					'project_customer_id' => $result['project_customer_id'],
					'name'        => strip_tags(html_entity_decode($result['company_eng_name'], ENT_QUOTES, 'UTF-8'))
				);
			}
		}

		$sort_order = array();

		foreach ($json as $key => $value) {
			$sort_order[$key] = $value['name'];
		}

		array_multisort($sort_order, SORT_ASC, $json);

		$this->response->addHeader('Content-Type: application/json');
		$this->response->setOutput(json_encode($json));
	}


	public function autocomplete3() {
		$json = array();

		if (isset($this->request->get['filter_name'])) {
			$this->load->model('hk/wechat_inland');

			$filter_data = array(
				'filter_name' => $this->request->get['filter_name'],
				'start'       => 0,
				'limit'       => 5
			);

			$results = $this->model_hk_wechat_inland->getPojectVendor($filter_data);

			foreach ($results as $result) {
				$json[] = array(
					'vendor_details_id' => $result['vendor_details_id'],
					'name'        => strip_tags(html_entity_decode($result['english_name_of_supplier'], ENT_QUOTES, 'UTF-8'))
				);
			}
		}

		$sort_order = array();

		foreach ($json as $key => $value) {
			$sort_order[$key] = $value['name'];
		}

		array_multisort($sort_order, SORT_ASC, $json);

		$this->response->addHeader('Content-Type: application/json');
		$this->response->setOutput(json_encode($json));
	}


	public function upload() {
		$this->language->load('hk/wechat_inland');
		$this->load->model('hk/wechat_inland');

		$json = array();

		// Check user has permission
		if (!$this->user->hasPermission('modify', 'hk/wechat_inland')) {
			$json['error'] = $this->language->get('error_permission');
		}

		// Make sure we have the correct directory
		if (isset($this->request->get['directory'])) {
			$directory = rtrim(DIR_PROJECT . 'project/' . str_replace(array('../', '..\\', '..'), '', $this->request->get['directory']), '/');
		} else {
			$directory = DIR_PROJECT . 'project';
		}

		// Check its a directory
		if (!is_dir($directory)) {
			$json['error'] = $this->language->get('error_directory');
		}

		if (!$json) {
			if (!empty($this->request->files['file']['name']) && is_file($this->request->files['file']['tmp_name'])) {
				// Sanitize the filename
				$filename = basename(html_entity_decode($this->request->files['file']['name'], ENT_QUOTES, 'UTF-8'));

				// Validate the filename length
				if ((utf8_strlen($filename) < 3) || (utf8_strlen($filename) > 128)) {
					$json['error'] = $this->language->get('error_filename');
				}

				// Allowed file extension types
				$allowed = array();
				$FileTypeExt = "png
jpe
jpeg
jpg
pdf
xls
xlsx
doc";
				$FileTypeMime = "image/png
image/jpeg
application/msword
application/vnd.ms-excel
application/vnd.openxmlformats-officedocument.spreadsheetml.sheet
application/pdf";
				$extension_allowed = preg_replace('~\r?\n~', "\n", $FileTypeExt);

				$filetypes = explode("\n", $extension_allowed);

				foreach ($filetypes as $filetype) {
					$allowed[] = trim($filetype);
				}

				if (!in_array(strtolower(substr(strrchr($filename, '.'), 1)), $allowed)) {
					$json['error'] = $this->language->get('error_filetype');
				}
				// var_dump($this->config->get('config_file_mime_allowed'));exit;
				// Allowed file mime types
				$allowed = array();

				$mime_allowed = preg_replace('~\r?\n~', "\n", $FileTypeMime);

				$filetypes = explode("\n", $mime_allowed);

				foreach ($filetypes as $filetype) {
					$allowed[] = trim($filetype);
				}

				if (!in_array($this->request->files['file']['type'], $allowed)) {
					$json['error'] = $this->language->get('error_filetype');
				}

				// Check to see if any PHP files are trying to be uploaded
				$content = file_get_contents($this->request->files['file']['tmp_name']);

				if (preg_match('/\<\?php/i', $content)) {
					$json['error'] = $this->language->get('error_filetype');
				}

				// Return any upload error
				if ($this->request->files['file']['error'] != UPLOAD_ERR_OK) {
					$json['error'] = $this->language->get('error_upload_' . $this->request->files['file']['error']);
				}
			} else {
				$json['error'] = $this->language->get('error_upload');
			}
		}

		if (!$json) {
			$file = token(16).'_'.$this->request->files['file']['name'];
			$uploadfile = $directory . '/' .$file;
			move_uploaded_file($this->request->files['file']['tmp_name'], $uploadfile);
			$project_file_id = $this->model_hk_wechat_inland->addFile($filename,$uploadfile);
			$json['filename'] = $file;
			$json['mask'] = $filename;
			$json['uploadfile'] = $uploadfile;
			$json['project_file_id'] = $project_file_id;
			$json['tmp_name'] = $this->request->files['file']['tmp_name'];

			$json['success'] = $this->language->get('text_upload');
		}

		$this->response->addHeader('Content-Type: application/json');
		$this->response->setOutput(json_encode($json));
	}
<<<<<<< HEAD
>>>>>>> d186f0ac043b98de93b00ad49075690d01e0cbaa
=======
>>>>>>> d186f0ac043b98de93b00ad49075690d01e0cbaa

	public function clear() {
		$this->load->language('hk/wechat_inland');
		$this->load->model('hk/wechat_inland');

		$json = array();

		if (!$this->user->hasPermission('modify', 'hk/wechat_inland')) {
			$json['error'] = $this->language->get('error_permission');
		}

		if (!$json) {

			$file = $this->request->request['name'];
			
			if(!empty($file)){
<<<<<<< HEAD
<<<<<<< HEAD
				$wechat_id = isset($this->request->request['wechat_id'])?$this->request->request['wechat_id']:null;
				$query	= $this->model_hk_wechat_inland->clearFile($wechat_id,$this->request->request['id'],$this->request->request['name']);

=======
				$project_progress_id = isset($this->request->request['project_progress_id'])?$this->request->request['project_progress_id']:null;
				$query	= $this->model_hk_wechat_inland->clearFile($project_progress_id,$this->request->request['id'],$this->request->request['name']);
				 // var_dump($query);
>>>>>>> d186f0ac043b98de93b00ad49075690d01e0cbaa
=======
				$project_progress_id = isset($this->request->request['project_progress_id'])?$this->request->request['project_progress_id']:null;
				$query	= $this->model_hk_wechat_inland->clearFile($project_progress_id,$this->request->request['id'],$this->request->request['name']);
				 // var_dump($query);
>>>>>>> d186f0ac043b98de93b00ad49075690d01e0cbaa
				
				
				if (is_file($query)) {
					unlink($query);
				} elseif (is_dir($query)) {
					rmdir($query);
				}

				$json['success'] = $this->language->get('text_clear');
			}else{
				$json['msg'] = 'No File!';
			}
		}

		$this->response->addHeader('Content-Type: application/json');
		$this->response->setOutput(json_encode($json));
	}
	public function file_upload(){
		$data['token'] = $this->session->data['token'];
		$data['header'] = $this->load->controller('common/header');
		$data['column_left'] = $this->load->controller('common/column_left');
		$data['footer'] = $this->load->controller('common/footer');
<<<<<<< HEAD
<<<<<<< HEAD
		$this->response->setOutput($this->load->view('hk/wechat_upload.tpl', $data));
	}
	public function upload() {
=======
		$this->response->setOutput($this->load->view('project/project_upload.tpl', $data));
	}
	public function uploads() {
>>>>>>> d186f0ac043b98de93b00ad49075690d01e0cbaa
=======
		$this->response->setOutput($this->load->view('project/project_upload.tpl', $data));
	}
	public function uploads() {
>>>>>>> d186f0ac043b98de93b00ad49075690d01e0cbaa
		$this->language->load('hk/wechat_inland');
		$this->load->model('hk/wechat_inland');

		$json = array();

		// Check user has permission
		if (!$this->user->hasPermission('modify', 'hk/wechat_inland')) {
			$json['error'] = $this->language->get('error_permission');
		}

		// Make sure we have the correct directory
		if (isset($this->request->get['directory'])) {
<<<<<<< HEAD
<<<<<<< HEAD
			$directory = rtrim(DIR_IMAGE.'wechat' . str_replace(array('../', '..\\', '..'), '', $this->request->get['directory']), '/');
		} else {
			$directory = DIR_IMAGE.'wechat';
=======
			$directory = rtrim(DIR_PROJECT . 'project_upload/' . str_replace(array('../', '..\\', '..'), '', $this->request->get['directory']), '/');
		} else {
			$directory = DIR_PROJECT . 'project_upload';
>>>>>>> d186f0ac043b98de93b00ad49075690d01e0cbaa
=======
			$directory = rtrim(DIR_PROJECT . 'project_upload/' . str_replace(array('../', '..\\', '..'), '', $this->request->get['directory']), '/');
		} else {
			$directory = DIR_PROJECT . 'project_upload';
>>>>>>> d186f0ac043b98de93b00ad49075690d01e0cbaa
		}

		// Check its a directory
		if (!is_dir($directory)) {
			$json['error'] = $this->language->get('error_directory');
		}

		if (!$json) {
			if (!empty($this->request->files['file']['name']) && is_file($this->request->files['file']['tmp_name'])) {
				// Sanitize the filename
				$filename = basename(html_entity_decode($this->request->files['file']['name'], ENT_QUOTES, 'UTF-8'));

				// Validate the filename length
				if ((utf8_strlen($filename) < 3) || (utf8_strlen($filename) > 128)) {
					$json['error'] = $this->language->get('error_filename');
				}

				// Allowed file extension types
				$allowed = array();
				$FileTypeExt = "png
jpe
jpeg
jpg
pdf
xls
xlsx
docx
doc";
				$FileTypeMime = "image/png
image/jpeg
application/msword
application/vnd.ms-excel
application/vnd.openxmlformats-officedocument.spreadsheetml.sheet
application/vnd.openxmlformats-officedocument.wordprocessingml.document
application/pdf";
				$extension_allowed = preg_replace('~\r?\n~', "\n", $FileTypeExt);

				$filetypes = explode("\n", $extension_allowed);

				foreach ($filetypes as $filetype) {
					$allowed[] = trim($filetype);
				}

				if (!in_array(strtolower(substr(strrchr($filename, '.'), 1)), $allowed)) {
					$json['error'] = $this->language->get('error_filetype');
				}
				// var_dump($this->config->get('config_file_mime_allowed'));exit;
				// Allowed file mime types
				$allowed = array();

				$mime_allowed = preg_replace('~\r?\n~', "\n", $FileTypeMime);

				$filetypes = explode("\n", $mime_allowed);

				foreach ($filetypes as $filetype) {
					$allowed[] = trim($filetype);
				}

				if (!in_array($this->request->files['file']['type'], $allowed)) {
					$json['error'] = $this->language->get('error_filetype');
				}

				// Check to see if any PHP files are trying to be uploaded
				$content = file_get_contents($this->request->files['file']['tmp_name']);

				if (preg_match('/\<\?php/i', $content)) {
					$json['error'] = $this->language->get('error_filetype');
				}

				// Return any upload error
				if ($this->request->files['file']['error'] != UPLOAD_ERR_OK) {
					$json['error'] = $this->language->get('error_upload_' . $this->request->files['file']['error']);
				}
			} else {
				$json['error'] = $this->language->get('error_upload');
			}
		}

		if (!$json) {
			$file = token(16).'_'.$this->request->files['file']['name'];
			$uploadfile = $directory . '/' .$file;
			move_uploaded_file($this->request->files['file']['tmp_name'], $uploadfile);
<<<<<<< HEAD
<<<<<<< HEAD
			$wechat_file_id = $this->model_hk_wechat_inland->addFile($filename,$uploadfile);
			$json['filename'] = $file;
			$json['mask'] = $filename;
			$json['uploadfile'] = $uploadfile;
			$json['wechat_file_id'] = $wechat_file_id;
=======
=======
>>>>>>> d186f0ac043b98de93b00ad49075690d01e0cbaa
			$project_file_id = $this->model_hk_wechat_inland->addFile($filename,$uploadfile);
			$json['filename'] = $file;
			$json['mask'] = $filename;
			$json['uploadfile'] = $uploadfile;
			$json['project_file_id'] = $project_file_id;
<<<<<<< HEAD
>>>>>>> d186f0ac043b98de93b00ad49075690d01e0cbaa
=======
>>>>>>> d186f0ac043b98de93b00ad49075690d01e0cbaa
			$json['tmp_name'] = $this->request->files['file']['tmp_name'];
			$json['code'] = 0;
			$json['success'] = $this->language->get('text_upload');
		}

		$this->response->addHeader('Content-Type: application/json');
		$this->response->setOutput(json_encode($json));
	}
	public function getFiles(){
		$this->load->model('hk/wechat_inland');
		// $file_ids = ($this->request->post['da'])?$this->request->post['da']：'';
		// $file_id = implode(",",$file_ids);
		if(!empty($this->request->post['da'])){
			$file_id = implode(",",$this->request->post['da']);
			$result = $this->model_hk_wechat_inland->getFiles($file_id);
			if($result){
				$json = array(
					'status' => 1,
					'msg' => 'success',
					'project_file' => $result,
				);
			}else{
				$json = array(
					'status' =>0,
					'msg' => 'error',
				);
			}
		}else{
			$json = array(
					'status' => 2,
					'msg' => 'error',
				);
		}
		$this->response->addHeader('Content-Type: application/json');
		echo json_encode($json);
	}
}